package com.abc.service;

import com.abc.entity.Xueshengjiaoshi;
import com.abc.mapper.XueshengJiaoshiMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class XueshengJiaoshiService {

    @Autowired
    private XueshengJiaoshiMapper xueshengJiaoshiMapper;

    public List<Map<String,String>> findAllXueshengjiaoshi(){
        return xueshengJiaoshiMapper.findAllXueshengjiaoshi();
    }
    public String addXueshengjiaoshi(Xueshengjiaoshi xueshengjiaoshi){
        Xueshengjiaoshi xueshengjiaoshi1 = xueshengJiaoshiMapper.findByXueshengjiaoshiId(xueshengjiaoshi);
        if(xueshengjiaoshi1!=null){
            return "此学生教师已绑定关系，不能再绑定了";
        }
        int k = xueshengJiaoshiMapper.insertXueshengjiaoshi(xueshengjiaoshi);
        if(k>0){
            return "绑定成功";
        }else{
            return "绑定失败";
        }
    }
    public List<Map<String,Object>> findAllXueshengjiaoshiByJiaoshiid(String jiaoshiid){
        return xueshengJiaoshiMapper.findAllXueshengjiaoshiByJiaoshiid(jiaoshiid);
    }
    public List<Map<String,Object>> findAllXueshengjiaoshiXSByJiaoshiid(String jiaoshiid){
        return xueshengJiaoshiMapper.findAllXueshengjiaoshiXSByJiaoshiid(jiaoshiid);
    }

}
